<template>
  <el-dialog :title="title" :visible.sync="open" width="45%" append-to-body>
    <div class="img_bg">
      <img src="@/assets/images/mob_bg.png" alt />
    </div>
    <div class="content_wrap">
      <div class="item">
        <div class="list">
          <span class="title">名称</span>
          <span class="name">{{ dataForm.productName }}</span>
        </div>
        <div class="list">
          <span class="title">图片</span>
          <p class="img">
            <image :src="imgUrl + dataForm.imgUrl" mode=""></image>
          </p>
        </div>
        <div class="list">
          <span class="title">品牌</span>
          <span class="name">{{ dataForm.brandName }}</span>
        </div>
        <div class="list">
          <span class="title">分类</span>
          <span class="name">{{ dataForm.productCategoryName }}</span>
        </div>
        <div class="list">
          <span class="title">价格</span>
          <span class="name">${{ priceTotal }}</span>
        </div>
        <div class="list">
          <span class="title">参数</span>
        </div>
        <div class="name_list" v-for="(item, index) in dataForm.detailsList" :key="index">
          <span class="title">{{ item.detailsMenuName }}</span>
          <span class="name">{{ item.detailValue }}</span>
        </div>
        <div class="list">
          <span class="title">产品详情</span>
        </div>
        <div class="name_list">
          <span class="title">{{ dataForm.productInfo }}</span>
        </div>
      </div>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="open = false">取 消</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { getAuditInfo } from "@/api/product";
export default {
  name: "productAdd",
  dicts: ["is_show", "user_level"],
  computed: {},
  data() {
    return {
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 表单参数
      dataForm: {},
      priceTotal:0
    };
  },
  methods: {
    init(e) {
      this.open = true;
      this.title = "产品预览";
      this.handleUpdate(e);
    },
    handleUpdate(row) {
      getAuditInfo(row).then((res) => {
        const { code, data, msg } = res;
        if (code != 200) return this.$modal.msgError(msg);
        this.dataForm = { ...data };
        this.priceTotal = data.priceList[0].price || 0
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.img_bg {
  width: 100%;
  height: 100%;
  img {
    width: 100%;
    height: 100%;
  }
}

.content_wrap {
  position: absolute;
  top: 104px;
  width: 94%;
  left: 8px;
  height: 560px;
  overflow-y: auto;
}
::v-deep .el-dialog__body {
  padding: 0;
  height: 740px;
  width: 38%;
  overflow: hidden;
  margin: 0 auto;
  position: relative;
}

.item{
	width: 90%;
	margin: 0 auto;
	.list{
		display: flex;
		justify-content: space-between;
		height: 50px;
		align-items: center;
		border-bottom: 1px solid #eee;
		.title{
			color: #333;
      margin: 0;
      padding: 0 ;
		}
		.name{
			font-size: 14px;
			color: #999;
			margin-right: 5px;
		}
		.icon{
			margin-right: 10px;
		}
		.img{
			width: 40px;
			height: 40px;
			border: 1px solid #eee;
			image{
				width: 100%;
				height: 100%;
			}
		}
	}
}
.name_list{
	width: 95%;
	display: flex;
	justify-content: space-between;
	height: 40px;
	line-height: 40px;
	border-bottom: 1px solid #eee;
	margin: 0 auto;
	.title{
		color: #666;
	}
	.name{
		color: #999;
	}
}
</style>
